<!DOCTYPE html>
<!--********************************************-->
<!--*       Generated from PreTeXt source      *-->
<!--*                                          *-->
<!--*         https://pretextbook.org          *-->
<!--*                                          *-->
<!--********************************************-->
<html lang="en-US">
<head xmlns:og="http://ogp.me/ns#" xmlns:book="https://ogp.me/ns/book#">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Even and Odd Functions</title>
<meta name="Keywords" content="Authored in PreTeXt">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:type" content="book">
<meta property="book:title" content="MATH 2023: Ordinary and Partial Differential Equations">
<meta property="book:author" content="Xiaoyi Chen and Wei Zhang">
<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script><script>window.MathJax = {
  tex: {
    inlineMath: [['\\(','\\)']],
    tags: "none",
    tagSide: "right",
    tagIndent: ".8em",
    packages: {'[+]': ['base', 'extpfeil', 'ams', 'amscd', 'newcommand', 'knowl']}
  },
  options: {
    ignoreHtmlClass: "tex2jax_ignore|ignore-math",
    processHtmlClass: "process-math",
    renderActions: {
        findScript: [10, function (doc) {
            document.querySelectorAll('script[type^="math/tex"]').forEach(function(node) {
                var display = !!node.type.match(/; *mode=display/);
                var math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
                var text = document.createTextNode('');
                node.parentNode.replaceChild(text, node);
                math.start = {node: text, delim: '', n: 0};
                math.end = {node: text, delim: '', n: 0};
                doc.math.push(math);
            });
        }, '']
    },
  },
  chtml: {
    scale: 0.88,
    mtextInheritFont: true
  },
  loader: {
    load: ['input/asciimath', '[tex]/extpfeil', '[tex]/amscd', '[tex]/newcommand', '[pretext]/mathjaxknowl3.js'],
    paths: {pretext: "https://pretextbook.org/js/lib"},
  },
startup: {
    pageReady() {
      return MathJax.startup.defaultPageReady().then(function () {
      console.log("in ready function");
      $(document).trigger("runestone:mathjax-ready");
      }
    )}
},
};
</script><script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script><script src="https://pretextbook.org/js/lib/jquery.min.js"></script><script src="https://pretextbook.org/js/lib/jquery.sticky.js"></script><script src="https://pretextbook.org/js/lib/jquery.espy.min.js"></script><script src="https://pretextbook.org/js/0.13/pretext.js"></script><script>miniversion=0.674</script><script src="https://pretextbook.org/js/0.13/pretext_add_on.js?x=1"></script><script src="https://pretextbook.org/js/lib/knowl.js"></script><!--knowl.js code controls Sage Cells within knowls--><script>sagecellEvalName='Evaluate (Sage)';
</script><link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700&amp;subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/pretext.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/pretext_add_on.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/banner_default.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/toc_default.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/knowls_default.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/style_default.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/colors_blue_red.css" rel="stylesheet" type="text/css">
<link href="https://pretextbook.org/css/0.4/setcolors.css" rel="stylesheet" type="text/css">
</head>
<body class="pretext-book ignore-math has-toc has-sidebar-left">
<a class="assistive" href="#content">Skip to main content</a><div id="latex-macros" class="hidden-content process-math" style="display:none"><span class="process-math">\(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\lt}{&lt;}
\newcommand{\gt}{&gt;}
\newcommand{\amp}{&amp;}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle     \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle        \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle      \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)</span></div>
<header id="masthead" class="smallbuttons"><div class="banner"><div class="container">
<a id="logo-link" href=""></a><div class="title-container">
<h1 class="heading"><a href="MATH-2023-OPDE.html"><span class="title">MATH 2023: Ordinary and Partial Differential Equations</span></a></h1>
<p class="byline">Xiaoyi Chen and Wei Zhang</p>
</div>
</div></div>
<nav id="primary-navbar" class="navbar"><div class="container">
<div class="navbar-top-buttons">
<button class="sidebar-left-toggle-button button active" aria-label="Show or hide table of contents sidebar">Contents</button><div class="tree-nav toolbar toolbar-divisor-3">
<a class="index-button toolbar-item button" href="index-1.html" title="Index">Index</a><span class="threebuttons"><a id="previousbutton" class="previous-button toolbar-item button" href="sec7_4.html" title="Previous">Prev</a><a id="upbutton" class="up-button button toolbar-item" href="ch_seven.html" title="Up">Up</a><a id="nextbutton" class="next-button button toolbar-item" href="sec7_6.html" title="Next">Next</a></span>
</div>
</div>
<div class="navbar-bottom-buttons toolbar toolbar-divisor-4">
<button class="sidebar-left-toggle-button button toolbar-item active">Contents</button><a class="previous-button toolbar-item button" href="sec7_4.html" title="Previous">Prev</a><a class="up-button button toolbar-item" href="ch_seven.html" title="Up">Up</a><a class="next-button button toolbar-item" href="sec7_6.html" title="Next">Next</a>
</div>
</div></nav></header><div class="page">
<div id="sidebar-left" class="sidebar" role="navigation"><div class="sidebar-content">
<nav id="toc"><ul>
<li class="link frontmatter"><a href="meta_frontmatter.html" data-scroll="meta_frontmatter" class="internal"><span class="title">Front Matter</span></a></li>
<li class="link">
<a href="ch_first.html" data-scroll="ch_first" class="internal"><span class="codenumber">1</span> <span class="title">Introduction</span></a><ul>
<li><a href="sec_1-intro.html" data-scroll="sec_1-intro" class="internal">Classification of Differential Equations</a></li>
<li><a href="sec_2-intro.html" data-scroll="sec_2-intro" class="internal">Linear and Nonlinear Equation</a></li>
<li><a href="sec_3-intro.html" data-scroll="sec_3-intro" class="internal">Geometrical Aspect</a></li>
<li><a href="sec_4-intro.html" data-scroll="sec_4-intro" class="internal">Motivation</a></li>
</ul>
</li>
<li class="link">
<a href="ch_second.html" data-scroll="ch_second" class="internal"><span class="codenumber">2</span> <span class="title">First Order Ordinary Differential Equations</span></a><ul>
<li><a href="sec2_1.html" data-scroll="sec2_1" class="internal">Linear Equations</a></li>
<li><a href="sec2_2.html" data-scroll="sec2_2" class="internal">Further Discussion of Linear Equations (For reading only)</a></li>
<li><a href="sec2_3.html" data-scroll="sec2_3" class="internal">Separable Equations</a></li>
<li><a href="sec2_4.html" data-scroll="sec2_4" class="internal">Difference Between Linear and Nonlinear Equations</a></li>
<li><a href="sec2_5.html" data-scroll="sec2_5" class="internal">Applications of modeling with first order ODE(For reading only)</a></li>
<li><a href="sec2_6.html" data-scroll="sec2_6" class="internal">Exact Equations and Integrating Factors</a></li>
</ul>
</li>
<li class="link">
<a href="ch_third.html" data-scroll="ch_third" class="internal"><span class="codenumber">3</span> <span class="title">third Order Linear Equations</span></a><ul>
<li><a href="sec3_1.html" data-scroll="sec3_1" class="internal">Homogeneous equations with constant coefficient</a></li>
<li><a href="sec3_2.html" data-scroll="sec3_2" class="internal">Fundamental Solutions of Linear Homogeneous Equations</a></li>
<li><a href="sec3_3.html" data-scroll="sec3_3" class="internal">Linear Independence and Wronskian</a></li>
<li><a href="sec3_4.html" data-scroll="sec3_4" class="internal">Complex roots of the characteristic equations</a></li>
<li><a href="sec3_5.html" data-scroll="sec3_5" class="internal">Repeated Roots: Reduction of Order</a></li>
<li><a href="sec3_6.html" data-scroll="sec3_6" class="internal">Non-homogeneous Equations and Method of Undetermined Coefficients</a></li>
<li><a href="sec3_7.html" data-scroll="sec3_7" class="internal">Variation of Parameters</a></li>
</ul>
</li>
<li class="link">
<a href="ch_four.html" data-scroll="ch_four" class="internal"><span class="codenumber">4</span> <span class="title">Higher Order Linear Equations</span></a><ul>
<li><a href="sec4_1.html" data-scroll="sec4_1" class="internal">General Theory of the <span class="process-math">\(n\)</span>-th Order Linear Equations</a></li>
<li><a href="sec4_2.html" data-scroll="sec4_2" class="internal">Homogeneous Equations with Constant Coefficients</a></li>
<li><a href="sec4_3.html" data-scroll="sec4_3" class="internal">The Method of Undetermined Coefficients</a></li>
<li><a href="sec4_4.html" data-scroll="sec4_4" class="internal">The Method of Variation of Parameters</a></li>
</ul>
</li>
<li class="link">
<a href="ch_five.html" data-scroll="ch_five" class="internal"><span class="codenumber">5</span> <span class="title">Series Solutions of Second Order Linear Equations</span></a><ul>
<li><a href="sec5_1.html" data-scroll="sec5_1" class="internal">Brief Review on Power Series</a></li>
<li><a href="sec5_2.html" data-scroll="sec5_2" class="internal">Introduction</a></li>
<li><a href="sec5_3.html" data-scroll="sec5_3" class="internal">Series Solutions Near an Ordinary Point</a></li>
<li><a href="sec5_4.html" data-scroll="sec5_4" class="internal">Euler’s Equation</a></li>
<li><a href="sec5_5.html" data-scroll="sec5_5" class="internal">Series Solution near a Regular Singular Point</a></li>
</ul>
</li>
<li class="link">
<a href="ch_six.html" data-scroll="ch_six" class="internal"><span class="codenumber">6</span> <span class="title">System of First Order Linear Equations</span></a><ul>
<li><a href="sec6_1.html" data-scroll="sec6_1" class="internal">Introduction <span class="process-math">\(\&amp;\)</span> Basic Theory</a></li>
<li><a href="sec6_2.html" data-scroll="sec6_2" class="internal">Homogeneous System with Constant Coefficients</a></li>
<li><a href="sec6_3.html" data-scroll="sec6_3" class="internal">Complex Eigenvalues</a></li>
<li><a href="sec6_4.html" data-scroll="sec6_4" class="internal">Repeated Eigenvalues</a></li>
<li><a href="sec6_5.html" data-scroll="sec6_5" class="internal">Fundamental Matrices</a></li>
<li><a href="sec6_6.html" data-scroll="sec6_6" class="internal">Non-homogeneous linear systems</a></li>
</ul>
</li>
<li class="link">
<a href="ch_seven.html" data-scroll="ch_seven" class="internal"><span class="codenumber">7</span> <span class="title">Partial Differential Equations</span></a><ul>
<li><a href="sec7_1.html" data-scroll="sec7_1" class="internal">Two-Point Boundary Value Problems</a></li>
<li><a href="sec7_2.html" data-scroll="sec7_2" class="internal">Eigenvalue Problems</a></li>
<li><a href="sec7_3.html" data-scroll="sec7_3" class="internal">Fourier Series</a></li>
<li><a href="sec7_4.html" data-scroll="sec7_4" class="internal">The Fourier Convergence Theorem</a></li>
<li><a href="sec7_5.html" data-scroll="sec7_5" class="active">Even and Odd Functions</a></li>
<li><a href="sec7_6.html" data-scroll="sec7_6" class="internal">Introduction to Partial Differential Equations</a></li>
<li><a href="sec7_7.html" data-scroll="sec7_7" class="internal">1D Heat Equation; Solutions by Separation of Variable and Fourier Series</a></li>
<li><a href="sec7_8.html" data-scroll="sec7_8" class="internal">Other Heat Conduction Problems</a></li>
</ul>
</li>
<li class="link">
<a href="ch_eight.html" data-scroll="ch_eight" class="internal"><span class="codenumber">8</span> <span class="title">Laplace transform</span></a><ul>
<li><a href="sec8_1.html" data-scroll="sec8_1" class="internal">What are Laplace Transforms, and Why?</a></li>
<li><a href="sec8_2.html" data-scroll="sec8_2" class="internal">Finding Laplace Transforms</a></li>
<li><a href="sec8_3.html" data-scroll="sec8_3" class="internal">Finding inverse transforms using partial fractions</a></li>
<li><a href="sec8_4.html" data-scroll="sec8_4" class="internal">Solving ODEs and ODE Systems</a></li>
<li><a href="sec8_5.html" data-scroll="sec8_5" class="internal">Step input and Impulse problems</a></li>
<li><a href="sec8_6.html" data-scroll="sec8_6" class="internal">Laplace transform for PDE (heat equation)</a></li>
</ul>
</li>
<li class="link">
<a href="ch_features.html" data-scroll="ch_features" class="internal"><span class="codenumber">9</span> <span class="title">Examples of PreTeXt features</span></a><ul><li><a href="sec_features-blocks.html" data-scroll="sec_features-blocks" class="internal">Environments and Blocks</a></li></ul>
</li>
<li class="link backmatter"><a href="meta_backmatter.html" data-scroll="meta_backmatter" class="internal"><span class="title">Backmatter</span></a></li>
<li class="link"><a href="solutions-1.html" data-scroll="solutions-1" class="internal"><span class="codenumber">A</span> <span class="title">Selected Hints</span></a></li>
<li class="link"><a href="solutions-2.html" data-scroll="solutions-2" class="internal"><span class="codenumber">B</span> <span class="title">Selected Solutions</span></a></li>
<li class="link"><a href="appendix-1.html" data-scroll="appendix-1" class="internal"><span class="codenumber">C</span> <span class="title">List of Symbols</span></a></li>
<li class="link"><a href="index-1.html" data-scroll="index-1" class="internal"><span class="title">Index</span></a></li>
<li class="link"><a href="colophon-1.html" data-scroll="colophon-1" class="internal"><span class="title">Colophon</span></a></li>
</ul></nav><div class="extras"><nav><a class="pretext-link" href="https://pretextbook.org">Authored in PreTeXt</a><a href="https://www.mathjax.org"><img title="Powered by MathJax" src="https://www.mathjax.org/badge/badge.gif" alt="Powered by MathJax"></a></nav></div>
</div></div>
<main class="main"><div id="content" class="pretext-content"><section class="section" id="sec7_5"><h2 class="heading hide-type">
<span class="type">Section</span> <span class="codenumber">7.5</span> <span class="title">Even and Odd Functions</span>
</h2>
<p id="p-364">The effort that is expended in evaluation of the definite integrals that define the coefficients the <span class="process-math">\(a_0\text{,}\)</span> <span class="process-math">\(a_n\text{,}\)</span> and <span class="process-math">\(b_n\)</span> in the expansion of a function <span class="process-math">\(f\)</span> in a Fourier series is reduced significantly when <span class="process-math">\(f\)</span> is either an even or an odd function. Recall that a function <span class="process-math">\(f\)</span> is said to be</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\text{{\bf even}~ if } f(-􏰠x)=f(x)\quad \text{ and }\quad \text{{\bf odd}~ if } f(-􏰠x)=-􏰠f(x).
\end{equation*}
</div>
<p class="continuation">The following theorem lists some properties of even and odd functions.</p>
<ol id="p-365" class="decimal">
<li id="li-41"><p id="p-366">The product(quotient) of two even(odd) functions is even.</p></li>
<li id="li-42"><p id="p-367">The product of an even function and an odd function is odd.</p></li>
<li id="li-43"><p id="p-368">The sum(difference) of two even functions is even.</p></li>
<li id="li-44"><p id="p-369">The sum(difference) of two odd functions is odd.</p></li>
<li id="li-45"><p id="p-370">If <span class="process-math">\(f\)</span> is even, then 􏱙<span class="process-math">\(\int_{-a}^a f(x)~ \textrm{d} x=2\int_0^a f(x) \textrm{d} x\text{.}\)</span></p></li>
<li id="li-46"><p id="p-371">If <span class="process-math">\(f\)</span> is odd, then􏱙 􏱙<span class="process-math">\(\int_{-a}^a f(x)~ \textrm{d} x=0\text{.}\)</span></p></li>
</ol>
<p id="p-372">We have already observed that, if <span class="process-math">\(f(x)\)</span> is an even function, then its Fourier series will NOT have sine functions. If <span class="process-math">\(f(x)\)</span> is an odd function, then its Fourier series will NOT have cosine functions.</p>
<p id="p-373">The formulas for the Fourier coefficients could be simplified, as we have already observed.</p>
<ul id="p-374" class="disc">
<li id="li-47">
<p id="p-375">If <span class="process-math">\(f(x)\)</span> is an even, periodic function with <span class="process-math">\(2L\text{,}\)</span> it has a <dfn class="terminology">Fourier cosine series</dfn></p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\hat{f}(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos\frac{n\pi x}{L},
\end{equation*}
</div>
<p class="continuation">where</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
a_n=\frac{2}{L}\int_{0}^{L} f(x)\cos \frac{n\pi x}{L}~\textrm{d}x,\qquad n=\textcolor{black}{0},1,2,3,\cdots
\end{equation*}
</div>
</li>
<li id="li-48">
<p id="p-376">If <span class="process-math">\(f(x)\)</span> is an odd, periodic function with <span class="process-math">\(2L\text{,}\)</span> it has a <dfn class="terminology">Fourier sine series</dfn></p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\hat{f}(x)=\sum_{n=1}^{\infty}b_n\sin\frac{n\pi x}{L},
\end{equation*}
</div>
<p class="continuation">where</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
b_n=\frac{2}{L}\int_{0}^{L} f(x)\sin \frac{n\pi x}{L}~\textrm{d}x,\qquad n=1,2,3,\cdots
\end{equation*}
</div>
</li>
</ul>
<p id="p-377">If a function <span class="process-math">\(f(x)\)</span> is only defined on an interval <span class="process-math">\([0,L]\text{,}\)</span> we can extend/expand the domain into the whole real line by periodic expansion. There are two ways of doing this:</p>
<ul id="p-378" class="disc">
<li id="li-49"><p id="p-379">Extend <span class="process-math">\(f(x)\)</span> onto the interval <span class="process-math">\([-L, L]\)</span> such that <span class="process-math">\(f\)</span> is an even function, i.e., <span class="process-math">\(f(-x) = f(x)\text{,}\)</span> then extend it into a periodic function with <span class="process-math">\(2L\text{;}\)</span></p></li>
<li id="li-50"><p id="p-380">Extend <span class="process-math">\(f(x)\)</span> onto the interval <span class="process-math">\([-L,L]\)</span> such that <span class="process-math">\(f\)</span> is an odd function, i.e., <span class="process-math">\(f(-x) = -f(x)\text{,}\)</span> then extend it into a periodic function with <span class="process-math">\(2L\text{.}\)</span></p></li>
</ul>
<p id="p-381">These are called <dfn class="terminology">even/odd periodic extensions</dfn> of <span class="process-math">\(f\text{,}\)</span> or <dfn class="terminology">half-range expansions</dfn>.</p>
<p id="p-382">Let <span class="process-math">\(f(x) = x\)</span> for <span class="process-math">\(x \in [0,L]\text{.}\)</span> Sketch 3 periods of the even/odd extension of <span class="process-math">\(f\text{,}\)</span> and then compute the corresponding Fourier sine or cosine series.</p>
<ul id="p-383" class="disc">
<li id="li-51">
<p id="p-384">For the odd periodic extension, we have Fourier sine series:</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\hat{f}_{\text{odd}}(x)=\frac{2L}{\pi}\left[\sin\frac{\pi x}{L}-\frac{1}{2}\sin\frac{2\pi x}{L} +\frac{1}{3}\sin\frac{3\pi x}{L} -\frac{1}{4} \sin\frac{4\pi x}{L}+\cdots\right].
\end{equation*}
</div>
</li>
<li id="li-52">
<p id="p-385">For the even periodic extension, we have Fourier cosine series:</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\hat{f}_{\text{even}}(x)=\frac{L}{2}-\frac{4L}{\pi^2}\left[\cos\frac{\pi x}{L}+\frac{1}{9}\cos\frac{3\pi x}{L} +\frac{1}{5^2}\cos\frac{5\pi x}{L} +\frac{1}{7^2} \cos\frac{7\pi x}{L}+\cdots\right].
\end{equation*}
</div>
</li>
</ul>
<p id="p-386">We note that the Fourier cosine series, i.e, the even expansion seems to have smaller error for the same number of terms in the partial sum. This is because the even extension is a continuous function, while the odd extension is a piecewise continuous function with discontinuity points. All sine and cosine functions are smooth. Using smooth functions to represent discontinuous function would give larger error.</p>
<p id="p-387">From the convergence Theorem, we know that, at a discontinuous point, the Fourier series converges to the mid value of the left and right limits. This implies an error that is equal to half of the size of the jump at this point. This error will not become smaller by taking more terms in the partial sum.</p>
<p id="p-388">In practice, when one has the choice, it would always be recommended to choose the expansion that does NOT has discontinuities, if possible. So even expansions should be preferred for accuracy.</p></section></div></main>
</div>
</body>
</html>
